package com.company.config.client.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ConfigClientController {

    private static final Logger logger = LoggerFactory.getLogger(ConfigClientController.class);

    @Value("${spring.application.name}")
    private String applicationName;

    @Value("${eureka.client.service-url.defaultZone}")
    private String eurekaServers;

    @Value("${server.port}")
    private String port;

    @RequestMapping("/config")
    public String getConfig() {
        String result = "applicationName:" + applicationName + ",eurekaServers:" + eurekaServers + ",port:" + port;
        logger.info("获取到配置信息为：{}" + result);
        return result;
    }
}
